package com.gxa.service.goods.impl;

import com.gxa.dao.goods.GoodsOneTypeMapper;
import com.gxa.dao.goods.GoodsTypeMapper;
import com.gxa.pojo.goods.GoodsOneType;
import com.gxa.pojo.goods.Type;
import com.gxa.service.goods.GoodsTypeService;
import com.gxa.util.SqlSessionFactoryUtils;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

import java.util.List;

public class GoodsTypeServiceimpl implements GoodsTypeService {
    SqlSessionFactory sqlSessionFactory = SqlSessionFactoryUtils.getSqlSessionFactory();
    SqlSession sqlSession = sqlSessionFactory.openSession(true);
    GoodsTypeMapper mapper = sqlSession.getMapper(GoodsTypeMapper.class);

    @Override
    public List<Type> select(int begin,int size,Type type) {
        int page =(begin-1)*size;
        List<Type> select = mapper.select(page,size,type);
        return select;
    }

    @Override
    public int insert(Type type) {
        int insert = mapper.insert(type);
        return insert;
    }

    @Override
    public int updata(Type type) {
        int updata = mapper.updata(type);
        return updata;
    }

    @Override
    public int selectallPage() {
        int i = mapper.selectallPage();
        return i;
    }
}
